package com.sixth.controller;


import com.sixth.service.BuscarService1;
import com.sixth.util.CommonResult;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @program: carrent
 * @description:
 * @author: 老范
 * @create: 2022-01-13 21:43
 **/
@RestController
@RequestMapping("busCar")
@ResponseBody
public class BusCarController1 {
    @Autowired
    private BuscarService1 buscarService1;
    //根据条件查询
    @RequestMapping("listByCondition")
    public TableLayUi listByCondition(int page, int limit, String carnumber, String cartype, String color, Double price, Double rentprice , Double deposit, Integer isrenting, String description,String carimg){
        return buscarService1.listByCondition(page,limit,carnumber,cartype,color,price,rentprice,deposit,isrenting,description,carimg);
    }
    @RequestMapping("delete")
    public CommonResult delete(String carnumber){
        return buscarService1.delete(carnumber);
    }


    @RequestMapping("add")
    public CommonResult add(String carnumber, String cartype, String color, Double price, Double rentprice , Double deposit, Integer isrenting,String description,String carimg, Date createtime){
        return buscarService1.add(carnumber,cartype,color,price,rentprice,deposit,isrenting,description,carimg,createtime);
    }

    @RequestMapping("update")
    public CommonResult update(String carnumber, String cartype, String color, Double price, Double rentprice , Double deposit, Integer isrenting, String description,String carimg, Date createtime){
        return buscarService1.update(carnumber,cartype,color,price,rentprice,deposit,isrenting,description,carimg,createtime);
    }
    @RequestMapping("selectone")
    public TableLayUi selectone(String carnumber,String carimg){
        return buscarService1.selectone(carnumber,carimg);
    }
    //批量删除
    @RequestMapping("dels")
    public CommonResult dels(String carnumber){
        return buscarService1.batch(carnumber);
    }
}
